﻿//------------------------------------------------------------------------------
// System Name:   Customer Service Platform
// Component:     CIS Overseas ResourceInfoHelper
// Created By:    Samara Jiang (samaraj@wicresoft.com)
// Created Date:  2011-2-10
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ASBCC.Database.EntityFramework;

namespace ASBCC.Business.CIS
{
    /// <summary>
    ///  CIS Overseas ResourceInfoHelper
    /// </summary>
    public static class ResourceInfoHelper
    {
        /// <summary>
        /// 将一个ResourceInfo的激活状态设为未激活
        /// </summary>
        public static void SetResourceInfoDisabled(int resourceID)
        {
            using (var dc = new CCEntities())
            {
                dc.ResourceInfo.FirstOrDefault(p => p.ResourceID == resourceID).Disabled = true;
                dc.SaveChanges();
            }
        }

        /// <summary>
        /// 根据当前ID获取Name
        /// </summary>
        public static IEnumerable getName(int entityID)
        {
            using (var dc = new CCEntities())
            {
                var name = dc.ResourceInfo.FirstOrDefault(p => p.ResourceID == entityID).Name;
                return name;
            }
        }

        public static IEnumerable getNameEN(string employeeNo)
        {
            using (var dc= new CCEntities())
            {
                var name = dc.Employees.FirstOrDefault(p => p.EmployeeNo == employeeNo).NameEN;
                return name;
            }
        
        }
    }
}
